// 加载product_info.csv并注册为临时表
val productInfoDF = spark.read.format("csv")
  .option("header", "true")
  .load("path/to/product_info.csv")
productInfoDF.createOrReplaceTempView("product_info")

// 将sales_data.csv也注册为临时表
salesDF.createOrReplaceTempView("sales_data")

// 进行JOIN操作并展示结果
val joinedDF = spark.sql("""
  SELECT s.Product, p.Category, SUM(s.Quantity) AS TotalSales
  FROM sales_data s
  JOIN product_info p ON s.Product = p.Product
  GROUP BY s.Product, p.Category
""")
joinedDF.show()
